{extend name='main'}

{block name="button"}

{if auth("add")}
<button data-modal='{:url("add")}' data-title="添加用户" class='layui-btn layui-btn-sm layui-btn-primary'>添加用户</button>
{/if}

{if auth("remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些用户吗？" class='layui-btn layui-btn-sm layui-btn-primary'>删除用户</button>
{/if}

{/block}

{block name="content"}
    <div class="layui-row layui-col-space5">
        <div class="layui-col-md9">
            <div class="think-box-shadow">
                {include file='log/index_search'}
                <div class="layui-card-header">
                    日志信息
                    <div class="pull-right">
                        <div class="layui-box layui-laypage layui-laypage-default">

                            <a href="javascript:;" class="layui-laypage-prev {if !$prevUrl}layui-disabled{/if}" {if $prevUrl}data-open="{$prevUrl}&content={$Think.get.content}&log_time={$Think.get.log_time}&limit={$Think.get.limit|default=10}"{/if}>上一页</a>

                            <a href="javascript:;" class="layui-laypage-next {if !$nextUrl}layui-disabled{/if}"  {if $nextUrl}data-open="{$nextUrl}&content={$Think.get.content}&log_time={$Think.get.log_time}&limit={$Think.get.limit|default=10}"{/if}>下一页</a>
                            <span class="layui-laypage-limits">
                                <select lay-ignore="" style="margin-top: 8px;" id="select_limit">
                                    {for start="10" end="210" step="10"}
                                    <option value="{$i}" {eq name="i" value="$Think.get.limit"}selected{/eq}>{$i} 条/页</option>
                                    {/for}
                                </select>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="layui-card-body">
                    {foreach $list as $key=>$vo}
                    <pre class="layui-code" id="code{$key}">{$vo.info|raw|default='-'}</pre>
                    <script>
                        layui.use('code', function(){ //加载code模块
                            layui.code({
                                elem:'#code{$key}'
                                ,title:'{$key+1}.  {$vo.time}'
                                 ,about: false
                            });
                        });

                    </script>
                    {/foreach}
                </div>
                {empty name='list'}<span class="notdata">没有记录哦</span>{/empty}
            </div>
            <div id="test1"></div>

        </div>
        <div class="layui-col-md3">
            <div class="layui-row">
                <div class="think-box-shadow">
                    <div class="layui-card-header">日志文件</div>
                    <div class="layui-card-body">

                        <table class="layui-table"  lay-skin="line">
                            <colgroup>
                                <col width="150">
                                <col width="150">
                                <col width="200">
                                <col>
                            </colgroup>
                            <tbody>
                            {foreach $files as $vo}
                            <tr>
                                <td data-open="{:url('')}?file={$vo.path}" style="cursor: pointer;" {eq name="file" value="$vo.path"}class="layui-bg-gray"{/eq}>
                                <span class="color-blue">
                                    <div class="pull-left">
                                        {$vo.file_name}<br><span class="color-text">{$vo.size}</span>
                                    </div>
                                    <div class="pull-right color-desc"><button class="layui-btn layui-btn-xs layui-btn-danger pull-right" data-confirm="确认删除吗？不可恢复操作" data-action='{:url("remove")}' data-value="path#{$vo.path}"><i class="layui-icon layui-icon-delete"></i>删除</button><br><span class="pull-right">{$vo.update_time}</span></div>
                                </span>
                                </td>
                            </tr>
                            {/foreach}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script>
    $('#select_limit').change(function () {
        var val = $(this).val();
        $.form.href("{:url('')}?file={$Think.get.file}&offset={$Think.get.offset}&content={$Think.get.content}&log_time={$Think.get.log_time}&limit="+val);
    });
</script>
{/block}
